import CryptoJS from 'crypto-js'
export const aesEncrypt=(plaintext,{key,iv})=>{
    return CryptoJS.AES.encrypt(plaintext,CryptoJS.enc.Hex.parse(key),{
        iv:CryptoJS.enc.Hex.parse(iv),
        mode:CryptoJS.mode.CBC,
        padding:CryptoJS.pad.Pkcs7
    }).toString();
}
export const aesDecrypt=(ciphertext,{key,iv})=>{
    return CryptoJS.AES.decrypt(ciphertext,CryptoJS.enc.Hex.parse(key),{
        iv:CryptoJS.enc.Hex.parse(iv),
        mode:CryptoJS.mode.CBC,
        padding:CryptoJS.pad.Pkcs7
    }).toString(CryptoJS.enc.Utf8);
}
